package com.cxdr.awsips.analysis.pool;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

public class BaseQueue<E> {
	private LinkedBlockingQueue<E> queue = new LinkedBlockingQueue<E>();
	private static final int TIME_OUT = 1;
	public synchronized boolean contains(E file) {
		return queue.contains(file);
	}

	public  void add(E file) {
		queue.add(file);
	}

	public  E take() {
		E eml = null;
		try {
			//eml = queue.poll(TIME_OUT, TimeUnit.MICROSECONDS);
			eml= queue.take();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		return eml;
	}
	
	public synchronized boolean isEmpty(){
		return queue.isEmpty();
	}
}
